package com.almm.s_utils.Util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class TimeUtil {

    private static final Logger log = LoggerFactory.getLogger(TimeUtil.class);

    /**
     * Timestamp转换为时间字符串 格式 yyyy-MM-dd HH:mm:ss
     * @param timestamp timestamp时间对象
     * @return 时间字符串
     */
    public static String TimestampConvertStringYYYYMMDDHHMMSS(Timestamp timestamp) {
        if (timestamp == null) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(timestamp);
    }

    /**
     * 获取当前时间对象 timestamp
     * @return 返回当前时间对象 timestamp
     */
    public static Timestamp getNowTimestamp() {
        return new Timestamp(System.currentTimeMillis());
    }

    public static void main(String[] args) {
        try {
            BigDecimal bigDecimal = new BigDecimal("0");
            System.out.println(bigDecimal);
        }catch (Exception exception){
            log.error("异常:{}",exception.getMessage(),exception);
        }
    }



}
